package com.derbysoft.lowcostadapter.schedule.sync.impl;

import com.derbysoft.lowcostadapter.commons.model.Status;
import com.derbysoft.lowcostadapter.commons.redis.service.HotelCacheService;
import com.derbysoft.lowcostadapter.commons.repository.HotelRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by : jason
 * DateTime: 12-2-9
 */
@Component("syncHotelService")
public class SyncHotelServiceImpl extends SyncServiceBase {

    @Autowired
    private HotelRepository hotelRepository;

    @Autowired
    private HotelCacheService hotelCacheService;

    @Override
    protected void syncInternal() {
        hotelCacheService.saveAll(hotelRepository.list(Status.ENABLED));
    }
}
